package com.lee.sshclient;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by le on 2016/7/21.
 */
public class ShellClientContainer {
    final Map<String, ShellClient> shellClientMap = new HashMap<>();


    public void putClient(String name, ShellClient shellClient) {
        shellClientMap.put(name, shellClient);
    }

    public ShellClient getClient(String name) {
        return shellClientMap.get(name);
    }

    public void disconnect(String name) {
        ShellClient client = getClient(name);
        if(client != null) {
            client.disconnect();
            remove(name);
        }
    }

    public ShellClient remove(String name) {
        return shellClientMap.remove(name);
    }

}
